package org.blogwu.learn.jvmlearn.class1.class19;

import org.blogwu.learn.jvmlearn.class1.MyTest16;

public class MyTest17 {
    public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
        MyTest16 loader1 = new MyTest16("loader1");
        Class<?> cls1 = loader1.loadClass("org.blogwu.learn.jvmlearn.class1.class19.MySample");
        System.out.println("class hashcode:" + cls1.hashCode());
        System.out.println("class classloader:" + cls1.getClassLoader());

        //如果注释掉这行,那么并不会实例化MySample对象,及MySample构造方法不会调用
        //因此不会实例化MyCat对象,即没有对MyCat进行主动使用,这里就不会加载MyCat Class
        Object o1 = cls1.newInstance();
        System.out.println(o1.getClass());


    }
}
